<!DOCTYPE html>
<header>
    <meta charset="UTF-8">
    <title>个人信息系统11</title>
    <style>
        .wrap {
            margin-top: 150px;
            text-align: center;
        }
    </style>
</header>
<body>
<div class="wrap">
    <div id="userName"></div>
    <button id="btnLogout">登出</button>
</div>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="/js-cookie.js"></script>

<script>
    $(document).ready(function () {
        $.ajax({
            url: '/profile',
            type: 'GET',
            dataType: 'json',
            success: function (res) {
                $('#userName').html(res.userName);
            }
        })
        $.ajax({
            url: 'http://wthrcdn.etouch.cn/weather_mini?citykey=101210701',
            type: 'GET',
            dataType: 'json',
            success: function (res) {
                console.log(res);
                $('#userName').html(res.data.city+res.data.wendu+','+res.data.ganmao   );
            }
        })




        $('#btnLogout').click(function () {
            $.ajax({
                url: 'http://localhost:63342/untitled2/logout.php?_ijt=mhlo1evslfn52gk98l3k0fc3so',
                type: 'GET',
                contentType: 'application/json;charset=utf-8',
                success: function (res) {
                    if (res.message === 'success') {
                        location.href = './login.html';
                    }
                }
            })
        })
    })
</script>
</body>
</html>
